<html>

</html>
<script>
function Father(){
    this.FatherName = "Father";
}
Father.prototype.GetFatherName = function(){
    console.log("Father's name ",this.FatherName);
}
function Son(){
    this.SonName = "Son";
}
//继承：子类原型指向父类实例
Son.prototype = new Father();
//子类构造函数指向子类
Son.prototype.constroctor = Son;
Son.prototype.GetSonName = function(){
    console.log("Son's name ",this.SonName);
}

// var s = new Son();
// s.GetFatherName();
// new Son().GetFatherName();

//通过call借用父类的构造函数继承
function Father2(name,age){
    this.FatherName = name;
    this.FatherAge = age;
}
Father2.prototype.GetFather2Name = function(){
    console.log("Father2's name ",this.FatherName);
}

function Son2(name,age,money){
    this.SonMoney = money;
    //借用父类构造函数。属性在
    Father2.call(this,name,age);
}
Son2.prototype.GetSon2Name = function(){
    console.log("Son2's name ",this.SonMoney);
}

Son2.prototype = new Father2(); 
Son2.prototype.constroctor = Son2;

var s2 = new Son2("Father",18,2300);
s2.GetFather2Name();
console.log(s2);
</script>